package net.frankish.moviebank.front;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import net.frankish.moviebank2.front.MovieBankMenu;
import net.frankish.tools.progress.FrankishProgressBar;

public class Splash extends JFrame  {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JPanel jPanelCenter = null;
	private ImageIcon image = null;
	private long startTime;

	private FrankishProgressBar progressBar = new FrankishProgressBar();
	private static final URL urlLogo = MovieBankMenu.class.getResource( "/net/frankish/moviebank/images/128_movieStrips.png" );
	public Splash() {
		super();
		image = new ImageIcon(urlLogo);
		initialize();
	}
	/**
	 * This method initializes this
	 *
	 * @return void
	 */
	private void initialize() {
		this.setUndecorated(true);
		this.setSize(448, 270);
		this.setContentPane(getJContentPane());
		this.setUndecorated(true);
		setAlwaysOnTop(true);
		jPanelCenter.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				dispose();
			}
		});

	}
	/**
	 * This method initializes jContentPane
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
			jContentPane.add(getJPanelCenter(), BorderLayout.CENTER);
			jContentPane.add(progressBar,BorderLayout.SOUTH);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jPanelCenter
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanelCenter() {
		if (jPanelCenter == null) {
			jPanelCenter = new JPanel();
			jPanelCenter.setBackground(Color.white);
			jPanelCenter.setLayout(new GridBagLayout());
			jPanelCenter.add(new JLabel(image),new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0, 0));
			jPanelCenter.setPreferredSize(new Dimension(448, 270));
		}
		return jPanelCenter;
	}
	public FrankishProgressBar getProgressBar() {
		return progressBar;
	}


}



